package com.lfy.service;

import com.lfy.dao.UserDao;
import com.lfy.domian.User;
import com.lfy.domian.testEvent;
import org.apache.catalina.core.ApplicationPushBuilder;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class TestSendService {

    @Resource
    private UserDao userDao;
    @Resource
    private ApplicationEventPublisher pushBuilder;

    @Transactional
    public String send(){
        testEvent testEvent = new testEvent(this,"1");
        pushBuilder.publishEvent(testEvent);
        User user = new User();
        user.setPhone("9999");
        user.setUserid("4444");
        user.setPasswd("321312");
        user.setSchool("test");
        userDao.insertUser(user);




        return "ok";
    }
}
